package com.admin.monmon.util;

import java.util.ArrayList;
import java.util.List;

/**
 * @author caixiaofeng
 * @version 1.0
 * @Description: <<>>
 * @company 个人学习
 * @create 2021-02-04 15:55
 */
public final class SecurityConstants {
    public static final List<String> IGNORING_URL = new ArrayList<>();

    static {
        IGNORING_URL.add("/auth/login");
        IGNORING_URL.add("/auth/logout");
        IGNORING_URL.add("/auth/refreshToken");
        IGNORING_URL.add("/auth/info");
        IGNORING_URL.add("/doc.html");

        IGNORING_URL.add("/doc.html");
        IGNORING_URL.add("/v2/api-docs-ext");
        IGNORING_URL.add("/webjars/**");
        IGNORING_URL.add("/*/api-docs");
        IGNORING_URL.add("/swagger-resources/**");
        IGNORING_URL.add("/v2/api-docs/**");
        IGNORING_URL.add("/swagger-ui.html");
        IGNORING_URL.add("/swagger-resources/configuration/ui/**");
        IGNORING_URL.add("/swagger-resources/configuration/security/**");
    }

    public static final String AUTH_LOGIN_URL = "/auth/login";

    // Signing key for HS512 algorithm
    // You can use the page http://www.allkeysgenerator.com/ to generate all kinds of keys
    //密钥
    public static final String JWT_SECRET = "t6w9z$B&E)H@McQfTjWnZr4u7x!A%D*F-JaNdRgUkXp2s58y/B?E(H+KbPeShVmY";

    // JWT token defaults
    //请求头key
    public static final String TOKEN_HEADER = "Authorization";
    //token前缀
    public static final String TOKEN_PREFIX = "Bearer ";
    //token类型
    public static final String TOKEN_TYPE = "JWT";
    //发行人
    public static final String TOKEN_ISSUER = "secure-api";
    //使用平台
    public static final String TOKEN_AUDIENCE = "secure-app";
    //token有效时间
    public static final Long TOKEN_EXPIRATION = 1000 * 60L*60*24;
    //token失效刷新间隔
    public static final Long TOKEN_REFRESH = TOKEN_EXPIRATION * 2;

    private SecurityConstants() {
        throw new IllegalStateException("Cannot create instance of static util class");
    }
}
